package client;

public class NetworkDataReader implements DataReader {
	Properties properties;
	NetworkClient client;
	public NetworkDataReader(Properties properties){
		this.properties = properties;
		client = new TcpIPClient("");
		client.setProperties(properties);
		client.establishConnection();
	}
	@Override
	public Record findRecord(String termToFind) {
		String result = client.sendWithAnswer(termToFind);
		String[] resArray = result.split("#");
		Record resultRec = new Record(Integer.parseInt(resArray[0]),
									resArray[1], resArray[2]);
		return resultRec;
	}

}
